<template>
	<view>
		<!-- #ifdef MP-WEIXIN -->
		<!-- <u-navbar :is-back="false" :background="{background:'#fff'}" :height="0"></u-navbar> -->
		<!-- #endif -->
		<scroll-view scroll-y="true" class="scoll-viewS" @scrolltolower="scrolltolower" lower-threshold="400"
			@scroll="scroll" :scroll-top="scrollTop">

			<view class="wanl-user" :style="{ 
					paddingTop:paddingTopWx,
					backgroundImage: 'url(' + 'https://img.aibbyp.com/wechat/images/user_bg.png' + ')',
					color: common.appStyle.user_font_color == 'light'?'#ffffff':'#222222'}">
				<!-- style="background-color: #FFF;" 顶部背景色，掩盖头顶时间 电量 -->
				<view class="cu-bar fixed " :class="{'z-index': headerOpacity > 0}" :style="{ 
					opacity: headerOpacity,
					paddingTop: $wanlshop.wanlsys().top + 'px' }">
					<view class="cu-custom"
						:style="{color: common.appStyle.user_font_color == 'light'?'#ffffff':'#222222'}"
						style="width: 100%;">
					</view>
				</view>

				<!-- #ifndef MP -->
				<view class="cu-custom"
					:style="{color: common.appStyle.user_font_color == 'light'?'#ffffff':'#222222'}">
					<view class="cu-bar"
						:style="{ height: $wanlshop.wanlsys().height + 'px', paddingTop: $wanlshop.wanlsys().top + 'px' }">
						<view class="text-lg" @tap="$wanlshop.auth('/pages/user/setting/user')">
							<view v-if="headerOpacity == 1">
								<view class="cu-avatar round margin-right-xs"
									:style="{ backgroundImage: 'url(' + $wanlshop.oss(user.avatar, 35, 35, 2, 'avatar') + ')' }">
								</view>
								<text v-if="user.isLogin">{{ user.nickname }}</text>
								<text v-else>登录 / 注册</text>
							</view>
						</view>
						<!-- 背景 -->
						<view class="action" v-if="user.isLogin">
							<block>
								<text class="wlIcon-erweima" @tap="$wanlshop.auth('/pages/user/qrcode/qrcode')"></text>
								<text class="margin-right text-sm"
									@tap="$wanlshop.auth('/pages/user/qrcode/qrcode?title=公众号二维码')">会员码</text>
							</block>
							<text class="wlIcon-shezhi f28" @tap="$wanlshop.auth('/pages/user/setting/setting')"></text>
							<!-- <text class="wlIcon-xiaoxizhongxin" @tap="$wanlshop.to('/pages/notice/notice')"></text> -->
							<!-- <view class="cu-tag badge"
								v-if="statistics.notice.notice +statistics.notice.order +statistics.notice.chat > 0">
								{{ statistics.notice.notice +statistics.notice.order +statistics.notice.chat }}
							</view> -->
						</view>
					</view>
				</view>
				<!-- #endif -->
				<view class="user vw100">
					<view class="avatar margin-right-bj" @tap="$wanlshop.auth('/pages/user/portrait/portrait')">
						<image style="width: 120rpx;height: 120rpx;" class="round"
							:src="$wanlshop.oss(user.avatar, 62, 62, 2, 'avatar')" mode="">
						</image>
					</view>

					<view class="content flex1 overflow_1 mt24" v-if="user.isLogin">
						<view class="flex flex_ac">
							<view class="flex_ac overflow_1 flex1 ">
								<view class="f36 c3 fb overflow_1">
									{{ user.nickname }}
								</view>
								<view class="ml12 mt4 mr24" v-if="user.is_auth == 0"
									@tap.stop="$wanlshop.to('/pages/user/idCard/idCard')">
									<image class="qsm" src="https://img.aibbyp.com/wechatUser/qsm.png" mode=""></image>
								</view>
								<view class="qsm mt4 mr24" v-if="user.is_auth == 1">
									<image class="qsm" src="https://img.aibbyp.com/wechatUser/yrz.png" mode=""></image>
								</view>
							</view>

							<!-- #ifdef MP-WEIXIN -->

							<view class="action" v-if="user.isLogin">
								<text class="wlIcon-shezhi" @tap="$wanlshop.auth('/pages/user/setting/setting')"></text>
								<!-- <text class="wlIcon-xiaoxizhongxin" @tap="$wanlshop.to('/pages/notice/notice')"></text> -->
								<!-- <view class="cu-tag badge"
									v-if="statistics.notice.notice +statistics.notice.order +statistics.notice.chat > 0">
									{{ statistics.notice.notice +statistics.notice.order +statistics.notice.chat }}
								</view> -->
							</view>
							<!-- #endif -->
						</view>
						<view class="flex_ac f24 mt12">
							<view class="c6">
								粉丝 <text class="c3d f28 fb ml8">{{user.fans}}</text>
							</view>
							<view class="c6 ml24">
								关注 <text class="c3d f28 fb ml8">{{user.follow}}</text>
							</view>
							<button open-type="liveActivity"
								class="cu-btn round btnliveActivity1 pr12 pl12 margin-lr-bj wanl-bg-orange user_ranking "
								@click="qiandao">
								<u-icon name="https://img.aibbyp.com/wechat/images/rili.png" margin-left="15"
									size="28"></u-icon>
								<view class="separate-text">签到</view>

							</button>
						</view>

						<view v-if="false" class="text-sm u-flex" @tap="$wanlshop.auth('/pages/user/signin/signin')"
							style="margin-top: 24rpx;">
							<view class="bg_pink u-flex">
								<u-icon name="https://img.aibbyp.com/wechat/images/bg_love.png" margin-left="12"
									size="25"></u-icon>
								<text class="cu-tag sm bg_fff">Lv {{ user.level }}</text>
							</view>

						</view>
					</view>
					<!--  -->
					<view class="content" @tap="goLogin" v-else>
						<view class="text-xxl">登录 / 注册</view>
						<view class="cu-tag wanl-bg-pink sm radius">Hi，欢迎登录</view>
					</view>
				</view>
				<view class="operate">
					<view class="text-sm" @tap="$wanlshop.auth('/pages/note/indexList')">
						<text class="text-bold">{{ statistics.dynamic.note }}</text>
						<view class="c6 mt20 f24">作品</view>

					</view>
					<view class="text-sm" @tap="$wanlshop.auth('/pages/user/collect')">
						<text class="text-bold">{{ statistics.dynamic.collection }}</text>
						<view class="c6 mt20 f24">收藏</view>

					</view>
					<view class="text-sm" @tap="$wanlshop.auth('/pages/user/coupon/list')">
						<view class="cu-tag badge bg-orange" v-if="statistics.dynamic.coupon != 0"></view>
						<text class="text-bold">{{ statistics.dynamic.coupon }}</text>
						<view class="c6 mt20 f24">优惠券</view>
					</view>
					<view class="text-sm" @tap="$wanlshop.auth('/pages/user/follows/follows')">
						<text
							class="text-bold">{{ statistics.dynamic.follow_count ? statistics.dynamic.follow_count : 0 }}</text>

						<view class="c6 mt20 f24">关注</view>
					</view>
					<view class="text-sm" @tap="$wanlshop.auth('/pages/user/invite/invite')">
						<text
							class="text-bold">{{ statistics.dynamic.share_count ? statistics.dynamic.share_count : 0 }}</text>

						<view class="c6 mt20 f24">分享</view>
					</view>

				</view>
				<view class="activity padding-bj" v-show="false">
					<view class="bg-white radius grid text-center col-2 padding-lr-bj padding-tb-sm">
						<view class="solid-right flex justify-between" @tap="$wanlshop.auth('/pages/user/coupon/list')">
							<view class="content">
								<view class="wanl-black text-sm text-bold6">红包卡券</view>
								<view class="text-min text-orange">
									领取优惠券
									<text class="wlIcon-fanhui2 margin-left-xs"></text>
								</view>
							</view>
							<view class="cu-avatar"
								:style="{ backgroundImage: 'url(' + $wanlshop.appstc('/user/icon_card_bag.png') + ')' }">
							</view>
						</view>
						<view class="flex justify-between" @tap="$wanlshop.auth('/pages/user/signin/log')">
							<view class="content margin-left-bj">
								<view class="wanl-black text-sm text-bold6">我的积分</view>
								<view class="text-min text-orange">
									查看积分明细
									<text class="wlIcon-fanhui2 margin-left-xs"></text>
								</view>
							</view>
							<view class="cu-avatar"
								:style="{ backgroundImage: 'url(' + $wanlshop.appstc('/user/icon_super_vip.png') + ')' }">
							</view>
						</view>
					</view>
				</view>
			</view>

			<view class="wanl-user-order padding-sm margin-bj">
				<view class="u-flex top-title">
					<view>
						我的订单
					</view>
					<view @tap="$wanlshop.auth('/pages/user/order/order?state=0')" class="left-size">
						<text>查看全部</text>
						<u-icon name="arrow-right" size="25" color="#999999"></u-icon>
					</view>
				</view>
				<view class="project text-sm wanl-gray-dark">
					<view class="order-item">
						<button @tap="$wanlshop.auth('/pages/user/reservation/reservation')" class="btnliveActivity ">
							<image src="https://img.aibbyp.com/wechat/images/order/service.png" mode="widthFix"
								class="image"></image>
							<view class="font-bot">我的预约</view>
						</button>
						<view class="cu-tag badge bg-orange" v-if="statistics.order.task > 0">
							{{ $wanlshop.toFormat(statistics.order.task, 'hundred') }}
						</view>
					</view>
					<view class="order-item">
						<button @click="toOrder('/pages/user/order/order?state=1')" open-type="liveActivity"
							class=" btnliveActivity">
							<image src="https://img.aibbyp.com/wechat/images/order/payment.png" mode="widthFix"
								class="image"></image>
							<view class="font-bot">待支付</view>
						</button>
						<view class="cu-tag badge bg-orange" v-if="statistics.order.pay > 0">
							{{ $wanlshop.toFormat(statistics.order.pay, 'hundred') }}
						</view>
					</view>
					<view class="order-item">
						<button @click="toOrder('/pages/user/order/order?state=2')" open-type="liveActivity"
							class=" btnliveActivity">
							<image src="https://img.aibbyp.com/wechat/images/order/send.png" mode="widthFix"
								class="image">
							</image>
							<view class="font-bot">待发货</view>
						</button>
						<view class="cu-tag badge bg-orange" v-if="statistics.order.delive > 0">
							{{ $wanlshop.toFormat(statistics.order.delive, 'hundred') }}
						</view>
					</view>
					<view class="order-item">
						<button @click="toOrder('/pages/user/order/order?state=3')" open-type="liveActivity"
							class="btnliveActivity">
							<image src="https://img.aibbyp.com/wechat/images/order/recevie.png" mode="widthFix"
								class="image"></image>
							<view class="font-bot">待收货</view>
						</button>
						<view class="cu-tag badge bg-orange" v-if="statistics.order.receiving > 0">
							{{ $wanlshop.toFormat(statistics.order.receiving, 'hundred') }}
						</view>
					</view>
					<view class="order-item">
						<button class="solid-left btnliveActivity order-item"
							@tap="$wanlshop.auth('/pages/user/refund/lists')">
							<image src="https://img.aibbyp.com/wechat/images/order/quit.png" mode="widthFix"
								class="image">
							</image>
							<view class="font-bot">退货/售后</view>
						</button>
						<view class="cu-tag badge bg-orange" v-if="statistics.order.customer > 0">
							{{ $wanlshop.toFormat(statistics.order.customer, 'hundred') }}
						</view>
					</view>
				</view>
			</view>

			<view class="wanl-user-order padding-sm margin-bj" style="margin-top: 25rpx;" v-show="false">
				<view class="project text-sm wanl-gray-dark">
					<view style="line-height: 1.8;" @tap="$wanlshop.auth('/pages/user/coupon/mycard')">
						<view class="wanl-pip text-lg text-bold6">{{ statistics.dynamic.coupon }}</view>
						我的卡券
					</view>
					<view style="line-height: 1.8;" @tap="$wanlshop.auth('/pages/user/money/money')">
						<view class="wanl-pip text-lg text-bold6">{{ user.money?user.money:'0.00' }}</view>
						余额
					</view>
					<view style="line-height: 1.8;" @tap="$wanlshop.auth('/pages/user/bank/bank')">
						<view class="wanl-pip text-lg text-bold6">{{ statistics.dynamic.accountbank }}</view>
						银行卡
					</view>
					<view style="line-height: 1.8;" @tap="$wanlshop.auth('/pages/user/signin/log')">
						<view class="wanl-pip text-lg text-bold6">{{ user.score?user.score:0 }}</view>
						积分
					</view>
					<view class="solid-left" @tap="$wanlshop.auth('/pages/user/money/list')">
						<text class="wlIcon-hongbao wanl-orange"></text>
						账单明细
					</view>
				</view>
			</view>

			<view class="wanl-user-tool margin-lr-bj">
				<view class="u-flex top-title" style="margin: 0;padding:0 0 0 40rpx;">
					<view>
						服务中心
					</view>
				</view>
				<view class="list text-sm grid col-4 wanl-gray-dark">
					<!-- <view @tap="$wanlshop.auth('/pages/user/qrcode/qrcode')">
						<u-icon name="https://img.aibbyp.com/wechat/images/money.png" size="45"></u-icon>
						<view>邀请有礼</view>
					</view> -->
					<view @tap="$wanlshop.auth('/pages/user/integral/integral')">
						<u-icon name="https://img.aibbyp.com/wechat/images/mark.png" size="45"></u-icon>
						<view>积分商城</view>
					</view>
					<view @tap="$wanlshop.auth('/pages/user/address/address')">
						<u-icon name="https://img.aibbyp.com/wechat/images/dress.png" size="38"></u-icon>
						<view>收货地址</view>
					</view>
					<view @tap="$wanlshop.auth('/pages/user/money/money')">
						<u-icon name="https://img.aibbyp.com/wechat/images/money-a.png" size="45"></u-icon>
						<view>我的钱包</view>
					</view>
					<view @tap="$wanlshop.auth('/pages/user/footprint')">
						<u-icon name="https://img.aibbyp.com/wechat/images/historing.png" size="45"></u-icon>
						<view>浏览历史</view><strong></strong>
					</view>
					<view @tap="$wanlshop.auth('/pages/user/comment/comment')">
						<u-icon name="https://img.aibbyp.com/wechat/images/comment.png" size="45"></u-icon>
						<view> 我的评论 </view>
					</view>
					<!-- v-if="user.level == 1" -->
					<view @tap="$wanlshop.auth('/pages/craftsman/guide')" v-if="user.level == 1">
						<u-icon name="https://img.aibbyp.com/wechatUser/category1/icongjrz.png" size="45"></u-icon>
						<view> 工匠入驻 </view>
					</view>

					<!-- <view @tap="$wanlshop.auth('/pages/user/idCard/idCard')">
						<u-icon name="https://img.aibbyp.com/wechatUser/category1/icongjrz.png" size="45"></u-icon>
						<view> 实名认证</view>
					</view> -->
					<!-- <view>
					<u-icon name="https://img.aibbyp.com/wechat/images/activity.png" size="45"></u-icon>
					<view> 活动记录 </view>
					</view> -->
					<!-- <view>
					<u-icon name="https://img.aibbyp.com/wechat/images/service-over.png" size="45"></u-icon>
					<view> 全部服务 </view>
					</view> -->
				</view>
			</view>
			<!-- 工匠状态:0=无,1=个人,2=企业 -1资料待完善 worker_type -->
			<!-- 等级1:用户，2:个人工匠。3:公司工匠，5:区域服务商  level-->
			<view class="u-p-t-24" v-if="(user.level == 2 || user.level == 3) ">
				<view class="wanl-user-tool margin-lr-bj">
					<view class="u-flex top-title" style="margin: 0;padding:0 0 0 40rpx;">
						<view>
							工匠专属
						</view>
					</view>
					<view class="list text-sm grid col-4 wanl-gray-dark">
						<view class="">
							<button class="btnliveActivity" @click="gongjiangdingdan">
								<u-icon name="https://img.aibbyp.com/wechatUser/gj1.png" size="45"></u-icon>
								<view> 我的接单 </view>
							</button>
							<u-badge type="error" v-if="craftsmanNums.orderNum > 0" :count="craftsmanNums.orderNum"
								:offset="[-14,52]"></u-badge>
						</view>
						<view class="" v-if="user.level == 2">
							<button class="btnliveActivity"
								@tap="$wanlshop.auth('/pages/craftsman/list1?id='+user.user_id)">
								<u-icon name="https://img.aibbyp.com/wechatUser/craftsman/gjsq.png" size="45"></u-icon>
								<view> 申请加入 </view>


							</button>
							<u-badge type="error" v-if="craftsmanNums.recruitJoinNum > 0"
								:count="craftsmanNums.recruitJoinNum" :offset="[-14,52]"></u-badge>
						</view>
						<view class="" v-if="user.level == 2">
							<button class="btnliveActivity"
								@tap="$wanlshop.auth('/pages/craftsman/company/binding?id='+user.user_id)">
								<u-icon name="https://img.aibbyp.com/wechatUser/gj2.png" size="45"></u-icon>
								<view> 选择公司 </view>
								<u-badge type="error" v-if="craftsmanNums.joinNum > 0" :count="craftsmanNums.joinNum"
									:offset="[-14,52]"></u-badge>

							</button>
						</view>
						<view class="" v-if="user.level == 3">
							<button class="btnliveActivity"
								@tap="$wanlshop.auth('/pages/craftsman/list2recruit?id='+user.user_id)">
								<u-icon name="https://img.aibbyp.com/wechatUser/gj2.png" size="45"></u-icon>
								<view> 我的招募 </view>
								<u-badge type="error" v-if="craftsmanNums.myRecruitJoinNum > 0"
									:count="craftsmanNums.myRecruitJoinNum" :offset="[-14,52]"></u-badge>

							</button>
						</view>
						<view class="" v-if="user.level == 3">
							<button class="btnliveActivity"
								@tap="$wanlshop.auth('/pages/craftsman/company/acceptanceWork?id='+user.user_id)">
								<u-icon name="https://img.aibbyp.com/wechatUser/craftsman/gongjiangyanshou.png"
									size="45"></u-icon>
								<view> 工程验收 </view>
								<u-badge type="error" v-if="craftsmanNums.checkNum > 0" :count="craftsmanNums.checkNum"
									:offset="[-14,52]"></u-badge>

							</button>
						</view>
						<view class="" v-if="user.level == 2">
							<button class="btnliveActivity"
								@tap="$wanlshop.auth('/pages/craftsman/craftsmanHomepage?id='+user.user_id)">
								<u-icon name="https://img.aibbyp.com/wechatUser/gj4.png" size="45"></u-icon>
								<view> 个人主页 </view>
							</button>

						</view>
						<view class="" v-if="user.level == 3">
							<button class="btnliveActivity"
								@tap="$wanlshop.auth('/pages/craftsman/company/homepage?id='+user.user_id)">
								<u-icon name="https://img.aibbyp.com/wechatUser/craftsman/gongshizhuye.png"
									size="45"></u-icon>
								<view> 公司主页 </view>
							</button>
						</view>
						<!-- <view v-if="user.level == 3" @tap="$wanlshop.auth('/pages/craftsman/releaseOrder')">
							<u-icon name="https://img.aibbyp.com/wechat/images/nHome/wddp.png" size="45"></u-icon>
							<view> 发布订单 </view>
						</view> -->
						<view class="" v-if="user.level == 3">
							<button class="btnliveActivity" @tap="$wanlshop.auth('/pages/craftsman/company/settle')">
								<u-icon name="https://img.aibbyp.com/wechatUser/craftsman/gjsq.png" size="45"></u-icon>
								<view> 工匠申请 </view>
								<u-badge type="error" :count="craftsmanNums.workerJoin" :offset="[-14,52]"></u-badge>

							</button>
						</view>
						<!-- 	<view>
							<u-icon name="https://img.aibbyp.com/wechat/images/activity.png" size="45"></u-icon>
							<view> 活动记录 </view>
						</view> -->
						<!-- <view> -->
						<!-- <u-icon name="https://img.aibbyp.com/wechat/images/service-over.png" size="45"></u-icon> -->
						<!-- <view> 全部服务 </view> -->
						<!-- </view> -->
					</view>
				</view>
			</view>
			<!-- v-if="$store.state.common.config.setting" -->

			<view class="wanl-user-tool margin-lr-bj mt24">
				<view class="u-flex top-title" style="margin: 0;padding:0 0 0 40rpx;">
					<view>
						分享赚钱
					</view>
				</view>
				<view class="list text-sm grid col-4 wanl-gray-dark">

					<view @tap="$wanlshop.auth('/pages/user/inviteCraftsmen/index?type=1')">
						<u-icon name="https://img.aibbyp.com/wechatUser/yqyh.png" size="45"></u-icon>
						<view> 邀请用户 </view>
					</view>

					<view @tap="$wanlshop.auth('/pages/user/inviteCraftsmen/index?type=2')">
						<u-icon name="https://img.aibbyp.com/wechatUser/yqgg.png" size="45"></u-icon>
						<view> 邀请工匠 </view>
					</view>

					<view @tap="$wanlshop.auth('/pages/user/inviteCraftsmen/index?type=3')">
						<u-icon name="https://img.aibbyp.com/wechatUser/yqsj.png" size="45"></u-icon>
						<view> 邀请商家 </view>
					</view>

				</view>
			</view>
			<view>
				<view class="wanl-you-like"
					:style="{ backgroundImage: 'url(' + $wanlshop.appstc('/common/guess_you_like_it.png') + ')' }">
				</view>

				<wanl-product :shopnameType="true" :dataList="likeData" />
				<uni-load-more :status="status" :content-text="contentText" />
				<view class="edgeInsetBottom"></view>
			</view>
		</scroll-view>
		<view class="top-icon u-flex" @tap.stop="to_top()" v-show="isTop">
			<u-icon name="https://img.aibbyp.com/wechat/images/top-icon.png" size="38"></u-icon>
		</view>
		<WXofficialAccount></WXofficialAccount>
	</view>
</template>

<script>
	import {
		fail
	} from 'assert';
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {

				craftsmanNums: {},
				shopData: {},
				isTop: false,
				isTopOld: false,
				scrollTop: 0,
				old: {

					scrollTop: 0

				},
				headerOpacity: 0,
				// 上拉刷新
				settingTop: true,
				reload: true,
				call_num: 0,
				likeData: [],
				current_page: 1, //当前页码
				last_page: 1, //总页码
				status: 'loading',
				contentText: {
					contentdown: ' ',
					contentrefresh: '正在加载...',
					contentnomore: '没有更多数据了'
				},
				paddingTopWx: '',


			};
		},
		computed: {
			...mapState(['user', 'statistics', 'common'])
		},
		onPullDownRefresh() {
			this.loadData();
		},
		onLoad() {
			
		},
		onShow() {
			let _this = this
			uni.getNetworkType({
				success: function(res) {
					console.log(res.networkType);
					if (res.networkType == 'none') {
						setTimeout(() => {
							_this.onshowMethods()
						}, 200)
						return
					} else {
						_this.onshowMethods()
					}

				}
			});


		},
		created() {
			if (this.$store.state.user.isLogin) {
				// this.loadData();
			}
			this.loadlikeData();
			// #ifdef MP-WEIXIN

			this.paddingTopWx = this.$wanlshop.wanlsys().height + 'px'
			// #endif
			if (this.user && this.user.token) {
				this.$store.dispatch('user/getWechatSubscribe');
			}
		},
		onPageScroll(e) {
			let tmpY = 50;
			e.scrollTop = e.scrollTop > tmpY ? 50 : e.scrollTop; //如果当前高度大于250则250否则当前高度
			this.headerOpacity = e.scrollTop * (1 / tmpY); //$headerOpacity 赋值当前高度x（1÷250） 

			// console.log(this.headerOpacity)
		},
		methods: {
			onshowMethods() {
				this.userHome()
				if (this.user.level == 2 || this.user.level == 3) {
					this.getworkerOrderNum()
				}

				setTimeout(() => {
					uni.setNavigationBarColor({
						frontColor: this.$store.state.common.appStyle.user_font_color == 'light' ?
							'#ffffff' : '#000000',
						backgroundColor: this.$store.state.common.appStyle.user_nav_color
					})
				}, 200);
				if (this.$store.state.user.isLogin) {
					this.loadData();
				}
			},
			async gongjiangdingdan() {
				const shouldProceed = await this.$wanlshop.setrequestSubscribeMessage([
					'BH4v9RYDXCDOesZmSA4gUOQSIro5xIiOYkCnGYVeORk',
				])
				if (shouldProceed) {
					this.$wanlshop.auth('/pages/craftsman/list?id=' + this.user.user_id)
				}
			},
			async qiandao() {
				const shouldProceed = await this.$wanlshop.setrequestSubscribeMessage([
					'QRpGbDVWfQ_KBb-fyitX8nncJ1V7D1vSH4Qtw-FWu4w',
				])
				if (shouldProceed) {
					this.$wanlshop.auth('/pages/user/signin/signin')
				}

			},
			async toOrder(url) {
				// #ifdef H5
				this.$wanlshop.auth(url)
				// #endif
				const shouldProceed = await this.$wanlshop.setrequestSubscribeMessage([
					'2wtJZbU46iRzk6GMPV5I4lk9B0Sh_bbQk0Zp0tMmyTs',
					'KPkBIdZ6YU68e0cigd-xCVgEXekMGHAuRHeLjokby5Q',
					'J3VyZtBYkExI4G47u1aK83w4-xPM7pW6_GlwLo5I108',
				])
				if (shouldProceed) {
					this.$wanlshop.auth(url)
				}

			},
			// 个人主页信息
			userHome() {
				this.$api.post({
					url: '/wanlshop.user/userHome',
					data: {
						me: true
					}
				}).then(res => {
					this.user.fans = res.fans
					this.user.shop_id = res.shop_id
					this.user.follow = res.follow
				})
			},

			getworkerOrderNum() {
				this.$api.get({
					url: '/worker/user/workerOrderNum',
					success: res => {
						this.craftsmanNums = res
					}
				})
			},
			goLogin() {
				uni.setStorageSync("wanlshop:user", null)
				this.$wanlshop.auth('/pages/user/auth/auth')
			},
			SJRZ() {
				// 0=未注册商家
				if (this.shopData.status == 0 || this.shopData.status == 1) {
					this.$wanlshop.auth('/pages/shop/apply/details')
					return
				}
				// 2=资料已提交,审核中3=审核未通过
				if (this.shopData.status == 2 || this.shopData.status == 3) {
					this.$wanlshop.auth('/pages/m-shop/me/account/info/examine?status=2')
					return
				}
				if (this.shopData.status == 4) { // 未签订协议
					this.$wanlshop.auth('/pages/m-shop/me/account/info/agreement')
					return
				}
				if (this.shopData.status == 5) { // 未缴纳保证金
					this.$wanlshop.auth('/pages/m-shop/me/account/info/bond')
					return
				}
				if (this.shopData.status == 6) { // 正常
					uni.showModal({
						title: '无法新增',
						content: '已有店铺正常运营，如需修改请前往店铺管理中点击头像',
						showCancel: false,
						success: res => {}
					})
					return
				}
			},

			scroll(e) {
				this.settingTop = e.detail.scrollTop > 200 ? true : false
				let tmpY = 50;
				let scrollTop = e.detail.scrollTop > tmpY ? 50 : e.detail.scrollTop; //如果当前高度大于250则250否则当前高度
				this.headerOpacity = scrollTop * (1.0 / tmpY); //$headerOpacity 赋值当前高度x（1÷250） 

				let color = this.headerOpacity > 0.5 ? '#ffffff' : '#000000';
				uni.setNavigationBarColor({
					frontColor: color,
					backgroundColor: '#ff0000',
					animation: {
						duration: 400,
						timingFunc: 'easeIn'
					}
				})

				let g = this;
				this.old.scrollTop = e.detail.scrollTop
				this.isTop = e.detail.scrollTop >= 667 ? true : false


			},
			callPhone() {
				uni.makePhoneCall({
					phoneNumber: '028-83177139',
					success(res) {
						console.log(res, '---<>')
					},
					fail(err) {
						this.$wanlshop.msg('请在手机设置中打开此权限！')
					}
				})
			},
			changeAuth() {
				let that = this;
				let _permissionID = 'android.permission.CALL_PHONE';
				// #ifdef APP-PLUS
				plus.android.checkPermission(_permissionID,
					granted => {
						console.log("granted的值是:", granted.checkResult);
						if (granted.checkResult == "-1") {
							uni.showModal({
								title: '好饰商家版对您的/麦克风/权限申请说明',
								content: '便于您使用该功能语音拨打电话功能，如拒绝请在手机相关设置中手动打开该权限。',
								showCancel: false, // 不显示取消按钮
								success(res) {
									that.callPhone()
								}
							})
						} else {
							that.callPhone()
						}
					},
					error => {
						console.log("权限报错:", error.message);
					}
				);
				// #endif
				// #ifdef H5
				that.callPhone()
				// #endif
			},
			scrolltolower() {
				if (this.current_page >= this.last_page) {
					this.status = 'noMore';
				} else {
					this.reload = false;
					this.current_page = this.current_page + 1; //页码+1
					this.status = 'loading';
					this.loadlikeData();
				}
			},
			async loadData() {
				this.$api.post({
					url: '/wanlshop/user/refresh',
					success: res => {
						console.log(res, '---->')
						this.call_num = res.userinfo.call_num
						this.$store.commit('statistics/edit', res.statistics);
						this.$store.commit('user/setUserInfo', res.userinfo);
					}
				});
				uni.stopPullDownRefresh();
			},
			// 滚动底部加载猜你喜欢
			async loadlikeData() {
				this.$api.get({
					url: '/wanlshop/product/likes?pages=user',
					data: {
						page: this.current_page,
						limit: 10,
					},
					success: res => {
						this.likeData = this.reload ? res.data : this.likeData.concat(res
							.data); //评论数据 追加
						this.current_page = res.current_page; //当前页码
						this.last_page = res.last_page; //总页码
						this.status = res.total == 0 ? 'noMore' : 'more';
					}
				});
			},
			// 帮助
			help() {
				this.$wanlshop.to('/pages/user/help');
			},
			// 设置
			setting() {
				this.$wanlshop.to('/pages/user/setting/setting');
			},
			portrai() {
				this.$wanlshop.to('/pages/user/portrait/portrait');
			},
			to_top() {

				console.log('to_top')
				this.scrollTop = this.old.scrollTop
				this.$nextTick(function() {
					this.scrollTop = 0
				});

			}
		}
	};
</script>

<style lang="scss" scoped>
	.btnliveActivity::after {
		display: none;
	}

	.btnliveActivity {
		color: #666;
		font-size: 24rpx;
		background: transparent;
		padding: 0;
		height: 100rpx;
		line-height: 40rpx;
	}

	.qsm {
		width: 102rpx;
		height: 34rpx;
	}

	.action {
		.wlIcon-shezhi {
			font-size: 48rpx !important;
		}
	}

	.top-icon {
		justify-content: center;
		position: fixed;
		bottom: 10vh;
		z-index: 99;
		right: 60rpx;
		width: 82rpx;
		height: 82rpx;
		background: #000000;
		opacity: 0.7;
		border-radius: 50%;
	}

	.order-item .image {
		width: 60rpx;
		height: 44rpx;
	}

	.grid.col-4>uni-view {
		width: 33%;
	}


	.grid.col-3>uni-view {
		width: 25%;
	}

	.top-title {
		justify-content: space-between;
		font-size: 30rpx;
		color: #333333;
		height: 100rpx;
		padding: 0 0 0 20rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
	}

	.left-size {
		font-weight: 500;
		font-size: 28rpx;
		color: #999999;
	}

	.bg_pink {
		padding: 1rpx 10rpx;
		border: 2rpx solid #FFBD9F;
		background: rgba(255, 238, 229, 0.72);
		border-radius: 80rpx;
		color: #B53900;
	}

	.bg_fff {
		background-color: none;
		font-size: 24rpx;
	}

	.le-r {
		margin: 0 20rpx;
	}

	.cu-bar .action.mp:first-child>text[class*='wlIcon-'] {
		margin-left: 0;
	}

	.user_ranking {
		// position: absolute;
		// width: 150rpx;
		background: #FFA71C;
		height: 54rpx;
		color: #FFFFFF;
		font-size: 24rpx;
	}

	.separate-text {
		margin: 0 6rpx;
	}

	.scoll-viewS {
		width: 100vw;
		height: calc(110vh - 50px);
	}

	.wanl-user {
		background-repeat: no-repeat;
		background-size: 100%;
		position: relative;
		// #ifdef MP-WEIXIN
		padding-top: 130rpx;
		// #endif 
	}

	.wanl-user .user {
		display: flex;
		align-items: center;
		justify-content: space-between;
		position: relative;
		padding: 0 30rpx;
		padding-bottom: 30rpx;
	}

	.font-bot {
		position: relative;
	}

	.font-bots {
		bottom: 10rpx;
	}

	.wanl-user .user .avatar {
		position: relative;
		height: 123rpx;
		width: 143rpx;
		border-radius: 50%;
		border: 3px solid rgba(255, 255, 255, .25);
	}

	.wanl-user .user .avatar image {
		height: 120rpx;
	}

	.wanl-user .user .avatar .tag {
		position: absolute;
		bottom: 0;
		right: 0;
	}

	.wanl-user .user .content {
		flex: 1;
		position: relative;
	}

	/* 操作 */
	.wanl-user .operate {
		display: flex;
		justify-content: space-around;
		text-align: center;
		padding-bottom: 20rpx;
		line-height: 1.3;
	}

	.wanl-user .operate text {
		display: block;
		font-size: 32rpx;
	}

	/* 活动 */
	.wanl-user .activity {
		position: absolute;
		width: 100%;
		bottom: -80rpx;
	}

	.wanl-user .activity .radius {
		border-radius: 24rpx;
	}

	.wanl-user .activity .cu-avatar {
		width: 69rpx;
		height: 69rpx;
		margin-right: 30rpx;
		background-color: transparent;
		/* border: 1px solid rgba(255,255,255,.6); */
	}

	.wanl-user .activity .content {
		text-align: left;
		height: 68rpx;
	}

	/* 订单 */
	.wanl-user-order {
		border-radius: 24rpx;
		background-color: white;
	}

	.wanl-user-order .title {
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
	}

	.wanl-user-order .title text {}



	/* 状态 */
	.wanl-user-order .project {
		display: flex;
		justify-content: space-around;
		text-align: center;
	}

	.wanl-user-order .project>view {
		position: relative;
		flex: 1;
	}

	.wanl-user-order .project>view .cu-tag {
		top: -4rpx;
		right: 26rpx;
	}

	.wanl-user-order .project text {
		display: block;
		font-size: 50rpx;
		margin-bottom: 6rpx;
	}

	/* 物流 */
	.wanl-user-order .logistics {
		background-color: #f9f9f9;
		border-radius: 24rpx;
	}

	.wanl-user-order .logistics .swiper {
		height: 120rpx;
	}

	.wanl-user-order .logistics .swiper .title {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10rpx;
		color: #999999;
	}

	.wanl-user-order .logistics .swiper .cu-avatar {
		margin-right: 10rpx;
		height: 66rpx;
		width: 66rpx;
		border-radius: 12rpx;
		background-color: #ffffff;
	}

	.wanl-user-order .logistics .swiper .content .text-df {
		color: #3797e0;
		font-size: 27rpx;
		margin-bottom: 2rpx;
	}

	.wanl-user-order .logistics .swiper .content .text-sm {
		color: #999999;
	}

	.wanl-user-order .logistics .swiper .content text {
		font-size: 32rpx;
		margin-left: 15rpx;
		margin-right: 10rpx;
	}

	/* 工具箱 */
	.wanl-user-tool {
		background-color: #ffffff;
		border-radius: 24rpx;
	}

	.wanl-user-tool .title {
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
	}

	.wanl-user-tool .title text {
		margin-left: 2rpx;
	}

	/* 状态 */
	.wanl-user-tool .list {
		text-align: center;
	}

	.wanl-user-tool .list>view {
		margin-bottom: 28rpx;
		position: relative;
	}

	.wanl-user-tool .list>view .cu-tag {
		top: -8rpx;
		left: 80rpx;
		right: unset;
	}

	.wanl-user-tool .list text {
		display: block;
		font-size: 54rpx;
		margin-bottom: 8rpx;
	}

	.z-index {
		z-index: 99999 !important;
	}
</style>